package com.study.designpattern.proxy;

/**
 * <p>代理类</p>
 *
 * @author chentao
 * @version v 0.1 2022/9/9 14:43
 */
public class Proxy implements Subject {
    private Subject subject = null;

    public Proxy(Subject subject) {
        this.subject = subject;
    }

    @Override
    public void request() {
        this.before();
        subject.request();
        this.after();
    }

    private void after() {
        System.out.println("after");
    }

    private void before() {
        System.out.println("before");
    }
}
